package com.config.RoleInterceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class ConfigAdapter implements WebMvcConfigurer {

    @Bean
    SecurityInterceptor securityInterceptor() {
        return new SecurityInterceptor();
    }
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(securityInterceptor())
                .addPathPatterns("/DataBase/*").excludePathPatterns("/DataBase/getColumnData")
        .addPathPatterns("/getUserList").addPathPatterns("/updateUser")
        .addPathPatterns("/Connector/*").excludePathPatterns("/Connector/getListDataConnector")
        .excludePathPatterns("/Connector/getConnectorGroup")
        .excludePathPatterns("/Connector/getConnectorData");
        System.out.println("进入拦截器");
    }
}
